﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

#include <QGraphicsScene>
#include <QGraphicsItem>
#include <QPixmap>
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QMimeData>
#include <QFileInfo>
#include <QMessageBox>
#include <QMenu>
#include <QMenuBar>
#include <QAction>
#include <QTimer>
#include <QDebug>
#include <QScrollBar>
#include "qcustomgraphicseffect.h"
#include "websocketwnd.h"
#include <QCloseEvent>
#include <QThread>
#include <QSettings>
#include "async_client.h"




QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    void createActions();                        	//创建动作
    void createMenus();                           	//创建菜单
    void closeEvent(QCloseEvent* event);
private:
    QMenu* fileMenu;                           		//各项菜单栏
    QAction* openFileAction;                     	//文件菜单项
    QList<QFileInfo>* fileInfo;                     //获取文件列表
    QList<QFileInfo>* m_fileInfoSum;

    QPushButton *btn_socket_connect;
protected:
    void dragEnterEvent(QDragEnterEvent *event);
    void dropEvent(QDropEvent *event);
private:
    Ui::MainWindow *ui;
    AsyncProcess * async_process_;

//    WebSocketWnd subSocketWnd;
    QTimer m_Timer;
    QTimer _TcpSendTimer;
    QGraphicsScene scene;
    QGraphicsScene scene2;

    QList<QString> m_filePath;
    QList<QString> m_SumFilePath;
    int m_IndexFrame =0;

    QString  file_path_;
    QSettings* settings_;
    QStringList file_list_;
    int file_index_= 0;
    int cycle_times_ = 1;

    QString ip_addr;
    int send_interval;
    int port;
    int start_frame;
    int replay_cnt;

    QThread* thread_;
    void initSocketCfg();
signals:
    void sg_socket_connect();
    void outDisplay(QPixmap pixmap);
protected slots:
    void showOpenFile();
    void imageShow(QPixmap image);
    void startSendData();
private slots:
    void on_comboBox_activated(const QString &arg1);
    void on_pushButton_clicked();
    void on_horizontalSlider_sliderMoved(int position);
};
#endif // MAINWINDOW_H
